<% html_title @category.title %>

<div class="contextual">
  <%= render :partial => "categories/jump_box" %>
</div>

<p id="category-crumbs" class="breadcrumb">
	<%= link_to l(:label_kb_home), { :controller => 'articles', :action => 'index', :project_id => @project } %>
	<% @category.ancestors.each do |ancestor| %>
	&nbsp;&raquo;&nbsp;
	<%= link_to ancestor.title, { :controller => 'categories', :action => 'show', :id => ancestor.id, :project_id=>@project } %>
	<% end %>
</p>

<h2><%= @category.title %></h2>

<% content_for :sidebar do %>
	<ul id="options">
		<li><%= link_to_if_authorized l(:label_new_article), { :controller => 'articles', :action => 'new', :category_id => @category.id, :project_id => @project}, :class => 'icon icon-add' %></li>
    <li><%= link_to_if_authorized l(:label_new_category), { :controller => 'categories', :action => 'new', :parent_id => @category.id, :project_id => @project}, :class => 'icon icon-add' %></li>
    <li><%= link_to_if_authorized l(:label_edit_category), { :controller => 'categories', :action => 'edit', :id => @category.id, :project_id => @project}, :class => 'icon icon-edit' %></li>
    <li><%= link_to_if_authorized l(:label_delete_category), { :controller => 'categories', :action => 'destroy', :id => @category.id, :project_id => @project}, :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %></li>
	<li><%= watcher_tag(@category, User.current) %></li>
	</ul>
	<h3><%= l(:title_browse_by_category) %></h3>
  <%= render :partial => "categories/tree" %>
<% end %>

<div class="category-summary"><%= textilizable @category.description unless @category.description.nil? %></div>

<% @kids = @category.children %>
<% if @kids.length > 0 %>
  <div class="categories">
    <div class="category-header"><%= l(:label_subcategories) %></div>
    <br />
    <% @kids.each do |subs| %>
      <%= link_to subs.title + " (" + subs.articles.length.to_s + ")", { :controller => 'categories', :action => 'show', :id => subs.id, :project_id => @project }, :class => 'category-title' %>
    <% end %>
  </div>
<% end %>

<% if @category.articles.length > 0%>
  <div class="articles category-articles">
  <%= render :partial => 'articles/list_table', :locals => { :articles => @articles } %>
  </div>
<% end %>

<% other_formats_links do |f| %>
  <%= f.link_to 'Atom', :url => { :key => User.current.rss_key } %>
<% end %>

<% content_for :header_tags do %>
    <%= stylesheet_link_tag 'knowledgebase', :plugin => 'redmine_knowledgebase' %>
<% end %>
